﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace CMN.Controllers.View
{

    public class MvcViewEngine :System.Web.Mvc.WebFormViewEngine  //VirtualPathProviderViewEngine
    {
        public static DateTime AppStartTime;
        public MvcViewEngine()
        {

            //base.MasterLocationFormats = new string[] { "~/Manager/{1}/{0}.master", "~/Manager/Shared/{0}.master" };

            //base.AreaMasterLocationFormats = new[] {
            //    "~/Areas/{2}/Views/{1}/{0}.master",
            //    "~/Areas/{2}/Views/Shared/{0}.master",
            //};
            base.ViewLocationFormats = new[] {
                "~/Manager/SystemMain/{1}/{0}.aspx",
                "~/Manager/Extends/{1}/{0}.aspx",
                 "~/Manager/WebSiteApp/{1}/{0}.aspx",
                "~/Manager/Shared/{0}.aspx"
            };

            base.AreaViewLocationFormats = new[] {
                "~/Manager/Extends/{1}/{0}.aspx",
                "~/Manager/SystemMain/{1}/{0}.aspx",
                "~/Manager/WebSiteApp/{1}/{0}.aspx",
                "~/Manager/Shared/{0}.aspx"
            };

            base.PartialViewLocationFormats = ViewLocationFormats;
            base.AreaPartialViewLocationFormats = AreaViewLocationFormats;
          
                AppStartTime = DateTime.Now;

        }

        protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath)
        {
            return new WebFormView(partialPath, null);
        }

        protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath)
        {
            return new WebFormView(viewPath, masterPath);
        }

    }

}
